<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="DC.Type" content="topic">
  <meta name="DC.Title" content="Restoring an SQL Server Database">
  <meta name="product" content="">
  <meta name="DC.Relation" scheme="URI" content="sql-0044.html">
  <meta name="prodname" content="">
  <meta name="version" content="">
  <meta name="brand" content="30-OceanProtect Appliance 1.5.0-1.6.0 Help Center">
  <meta name="DC.Publisher" content="20241029">
  <meta name="prodname" content="csbs">
  <meta name="documenttype" content="usermanual">
  <meta name="DC.Format" content="XHTML">
  <meta name="DC.Identifier" content="sql-0047">
  <meta name="DC.Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
  <title>Restoring an SQL Server Database</title>
 </head>
 <body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px">
  <a name="sql-0047"></a><a name="sql-0047"></a>
  <h1 class="topictitle1">Restoring an SQL Server Database</h1>
  <div>
   <p>This section describes how to use a copy to restore a database that has been backed up to the original or different host.</p>
   <div class="section">
    <h4 class="sectiontitle">Prerequisites</h4>
    <ul>
     <li>Before restoring data to a different host, ensure that a database instance exists on the target host.</li>
     <li id="sql-0047__en-us_topic_0000001731610773_li17731230145317">Before restoration, ensure that the remaining space of the data directory at the target location for restoration is greater than the size of the copy used for restoration before reduction. Otherwise, restoration will fail.</li>
    </ul>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Procedure</h4>
    <ol>
     <li><span>Choose <span class="uicontrol" id="sql-0047__en-us_topic_0000001839142377_uicontrol17392202272717"><b><span id="sql-0047__en-us_topic_0000001839142377_text1939210224272"><strong>Explore</strong></span> &gt; <span id="sql-0047__en-us_topic_0000001839142377_text439314220278"><strong>Copy Data</strong></span> &gt; <span id="sql-0047__en-us_topic_0000001839142377_text14652358184918"><strong>Databases</strong></span> &gt; <span id="sql-0047__en-us_topic_0000001839142377_text6385151219337"><strong>SQL Server</strong></span></b></span>.</span></li>
     <li><span>You can search for copies by database resource or copy. This section describes how to search for copies by resource.</span><p></p><p>On the <span class="uicontrol"><b><span><strong>Resources</strong></span></b></span> tab page, find the resource to be recovered by resource name and click the resource name.</p> <p></p></li>
     <li><span>Select a resource for copy-based restoration.</span></li>
     <li><span>Specify a copy or a point in time for restoration.</span><p></p>
      <ul>
       <li>Restoration using a specified copy
        <ol type="a">
         <li>Select the year, month, and day in sequence to find the copy.<p>If <span><img src="en-us_image_0000002015617062.png"></span> is displayed under a month or date, a copy exists in the month or on the date.</p></li>
         <li>On the <strong>Copy Data</strong> page, click <span><img src="en-us_image_0000002051616649.png"></span> and choose <span class="menucascade"><b><span class="uicontrol"><span><strong>More</strong></span></span></b> &gt; <b><span class="uicontrol"><span><strong>Restore</strong></span></span></b></span> in the row where the desired copy is located.</li>
        </ol></li>
       <li>Restoration to a specified time point
        <ol type="a">
         <li>Select the year, month, and day in sequence to find the copy.<p>If <span><img src="en-us_image_0000002015458878.png"></span> is displayed under a month or date, a copy exists in the month or on the date.</p></li>
         <li>On the copy data page, click <span><img src="en-us_image_0000002051497613.png"></span>. In the blue part on the timeline, select a copy and choose <span class="menucascade"><b><span class="uicontrol"><span><strong>More</strong></span></span></b> &gt; <b><span class="uicontrol"><span><strong>Restore</strong></span></span></b></span>.</li>
        </ol></li>
      </ul> <p></p></li>
     <li><span><a href="#sql-0047__table93951625101715">Table 1</a> describes the parameters for restoring an SQL Server database.</span><p></p>
      <div class="tablenoborder">
       <a name="sql-0047__table93951625101715"></a><a name="table93951625101715"></a>
       <table cellpadding="4" cellspacing="0" summary="" id="sql-0047__table93951625101715" frame="border" border="1" rules="all">
        <caption>
         <b>Table 1 </b>Parameters of SQL Server database restoration
        </caption>
        <colgroup>
         <col style="width:32.53%">
         <col style="width:67.47%">
        </colgroup>
        <thead align="left">
         <tr>
          <th align="left" class="cellrowborder" valign="top" width="32.53%" id="mcps1.3.3.2.5.2.1.2.3.1.1"><p>Parameter</p></th>
          <th align="left" class="cellrowborder" valign="top" width="67.47%" id="mcps1.3.3.2.5.2.1.2.3.1.2"><p>Description</p></th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0047__p1024024017317"><span id="sql-0047__text15471356412"><strong>Restore To</strong></span></p></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0047__p16496164110123">Select either <span class="uicontrol" id="sql-0047__uicontrol84961241181211"><b><span id="sql-0047__text19159183316300"><strong>Original location</strong></span></b></span> or <span class="uicontrol" id="sql-0047__uicontrol12496341161217"><b><span id="sql-0047__text17983138143120"><strong>New location</strong></span></b></span>.</p></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0047__p653712813415"><span id="sql-0047__text105489481943"><strong>Location</strong></span></p></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0047__p16496184121216">If <strong id="sql-0047__b29321215184518">Restore To</strong> is set to <span class="uicontrol" id="sql-0047__uicontrol5674181313310"><b><span id="sql-0047__text48352563919"><strong>Original location</strong></span></b></span>, the original location is displayed by default.</p></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0047__p1339520259174"><span id="sql-0047__text329817453610"><strong>Target Host/Cluster</strong></span></p></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>If <strong>Restore To</strong> is set to <span class="uicontrol"><b><span><strong>New location</strong></span></b></span>, select the original host or a different host for restoration.</p></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Target Instance</strong></span></p></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0047__p6807933139">If <strong id="sql-0047__b1120593512444">Restore To</strong> is set to <span class="uicontrol" id="sql-0047__uicontrol63818461965"><b><span id="sql-0047__text625115598103"><strong>New location</strong></span></b></span>, select the instance on the target host.</p>
           <div class="note">
            <span class="notetitle"> NOTE: </span>
            <div class="notebody">
             <ul>
              <li>This parameter is displayed when <strong>Type</strong> is set to <strong>Databases</strong>.</li>
              <li>Ensure that databases or availability groups with the same name do not exist in the target instance.</li>
             </ul>
            </div>
           </div></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Target Path</strong></span></p>
           <div class="note">
            <span class="notetitle"> NOTE: </span>
            <div class="notebody">
             <p>This parameter is supported only in version 1.5.0.</p>
            </div>
           </div></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>Path of the target host to which database files are restored. This parameter is displayed when <strong>Restore To</strong> is set to <span class="uicontrol"><b><span><strong>New location</strong></span></b></span>.</p>
           <div class="note">
            <span class="notetitle"> NOTE: </span>
            <div class="notebody">
             <ul>
              <li>This parameter is displayed when <strong>Type</strong> is set to <strong>Databases</strong>.</li>
              <li>Ensure that drive letter of the target path instead of the drive letter root directory exists and the database user has the write permission on the target path.</li>
              <li>Ensure that no database file with the same name exists in the target path.</li>
             </ul>
            </div>
           </div></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Rename Database</strong></span></p></td>
          <td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>After this function is enabled, you can rename the restored database.</p>
           <div class="note">
            <span class="notetitle"> NOTE: </span>
            <div class="notebody">
             <ul>
              <li>This parameter is displayed when <strong>Type</strong> is set to <strong>Databases</strong>.</li>
              <li>If this function is enabled and the database is restored to the original location, select the owning instance of the database and scan for resources after the restoration completes (on the <strong>Protection</strong> &gt; <strong>Databases</strong> &gt; <strong>SQL Server</strong> &gt; <strong>Instances</strong> page, locate the row that contains the target instance, and choose <strong>More</strong> &gt; <strong>Resource Scan</strong>), and perform a full backup for the database.</li>
             </ul>
            </div>
           </div></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Script to Run Before Restoration</strong></span></p></td>
          <td class="cellrowborder" rowspan="3" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>You can execute a custom script before a restore job is executed and after it succeeds or fails based on your need.</p> <p>Enter a script name that ends with <strong>.bat</strong>. Ensure that the script is stored in the <strong>DataBackup\ProtectClient\ProtectClient-E\bin\thirdparty</strong> directory on the database host and the user (user <strong>root</strong> by default) who has logged in to the database host is permitted to execute the script.</p>
           <div class="note">
            <span class="notetitle"> NOTE: </span>
            <div class="notebody">
             <ul>
              <li>This parameter is displayed when <strong>Type</strong> is set to <strong>Databases</strong>.</li>
              <li>If <span class="uicontrol"><b><span><strong>Script to Run upon Restoration Success</strong></span></b></span> is configured, the status of the restoration job is displayed as <span class="uicontrol"><b><span><strong>Succeeded</strong></span></b></span> on the <span>product</span> even if the script fails to be executed. Check whether the job details contain information indicating that a post-processing script fails to be executed. If yes, modify the script in a timely manner.</li>
             </ul>
            </div>
           </div></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Script to Run upon Restoration Success</strong></span></p></td>
         </tr>
         <tr>
          <td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span><strong>Script to Run upon Restoration Failure</strong></span></p></td>
         </tr>
        </tbody>
       </table>
      </div> <p></p></li>
     <li><span>Click <span class="uicontrol"><b>OK</b></span>.</span></li>
    </ol>
   </div>
  </div>
  <div>
   <div class="familylinks">
    <div class="parentlink">
     <strong>Parent topic:</strong> <a href="sql-0044.html">Restoration</a>
    </div>
   </div>
  </div>
 </body>
</html>